package com.sxxm.qxgl.controller;


import com.sxxm.qxgl.dto.Userdto;
import com.sxxm.qxgl.dto.cx;
import com.sxxm.qxgl.dto.login;
import com.sxxm.qxgl.entity.SysUser;
import com.sxxm.qxgl.service.SysUserService;
import com.sxxm.qxgl.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author qjw
 * @since 2021-09-14
 */
@RestController
@Api(value = "用户", tags = "用户")
@RequestMapping("/sys-user")
public class SysUserController {
    SysUserService sysUserService;
    public SysUserController(SysUserService sysUserService){
        this.sysUserService=sysUserService;
    }
    @ApiOperation("登录")
    @PostMapping("/login")
    public Result login(@RequestBody login sysUser){
        return sysUserService.longin(sysUser.getAccount(),sysUser.getPassword());
    }
    @ApiOperation("查询")
    @PostMapping("/cx")
    public Result cx(@RequestBody cx sysUser){
        return sysUserService.cx(sysUser.getId(),sysUser.getAccount(),sysUser.getEmail(),sysUser.getMobile(),sysUser.getName(),sysUser.getPage(),sysUser.getNumber());
    }

    @ApiOperation("修改")
    @PostMapping("/ModifyThe")
    public Result ModifyThe(@RequestBody SysUser sysUser){
        return sysUserService.ModifyThe(sysUser);
    }
    @ApiOperation("添加")
    @PostMapping("/Addition")
    public Result Addition(@RequestBody SysUser sysUser){
        return sysUserService.Addition(sysUser);
    }

    @ApiOperation("删除")
    @PostMapping("/Delete")
    public Result Delete(@RequestBody SysUser sysUser){
        return sysUserService.Delete(sysUser.getId());
    }

    @ApiOperation("状态")
    @PostMapping("/zt")
    public Result zt(@RequestBody SysUser sysUser){
        return sysUserService.zt(sysUser.getId());
    }



}

